<#include "/include/macros.ftl">
<@header></@header>
<div class="clearfix"></div>
<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <ol class="breadcrumb">
            <li><a href="/">首页</a></li>
            <li class="active">模板管理</li>
        </ol>
        <div class="x_panel">
            <div class="x_content">

				<div class="panel panel-default">
					<div class="panel-heading">搜索</div>
					<div class="panel-body">
						<form role="form" id="searchForm" class="form-inline">
							
							<div class="form-group">
								<label for="sname1">孩子类型</label> 
								<input type="text" class="form-control" id="sname1" name="sname1" placeholder="请输入名称">
							</div>
							
							<div class="form-group">
								<label for="sname1">类型大类</label> 
								<input type="text" class="form-control" id="sname1" name="sname1" placeholder="请输入名称">
							</div>
							
							
							<!-- <div class="form-group">
								<button type="button" id="searchBtn" class="btn btn-default">开始搜索</button>
							</div> -->
							<div class="form-group">
                                <a href="javascript:;" id="searchware" class="btn btn-default btn-sm"><i class="fa fa-search"></i>查 询</a>
                            </div>
						</form>
					</div>
				</div>
				
                <div class="<#--table-responsive-->">
                    <div class="btn-group hidden-xs" id="toolbar">
                        <@shiro.hasPermission name="evaltemplate:add">
                        <button id="btn_add" type="button" class="btn btn-default" title="添加孩子">
                            <i class="fa fa-plus"></i> 添加
                        </button>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="evaltemplate:batchDelete">
                            <button id="btn_delete_ids" type="button" class="btn btn-default" title="删除选中">
                                <i class="fa fa-trash-o"></i> 批量删除
                            </button>
                        </@shiro.hasPermission>
                    </div>
                    <table id="tablelist">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<!--/弹框-->
<!--添加用户弹框-->
<div class="modal fade" id="addOrUpdateModal" tabindex="-1" role="dialog" aria-labelledby="addroleLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="addroleLabel">添加孩子</h4>
            </div>
            <div class="modal-body">
                <form id="addOrUpdateForm" class="form-horizontal form-label-left" novalidate>
                    <input type="hidden" name="id">
                    
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="childId">孩子编号: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="childId" id="childId" required="required" placeholder="请输入孩子编号"/>
                        </div>
                    </div>
                    
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="childName">孩子姓名: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="childName" id="childName" required="required" placeholder="请输入用户名"/>
                        </div>
                    </div>
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="nickname">昵称:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="nickName" id="nickname" required="required" placeholder="请输入昵称"/>
                        </div>
                    </div>
                    
                     <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="sex">性别: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <ul class="list-unstyled list-inline">
                                <li>
                                    <div class="radio">
                                        <label> <input type="radio" class="square" name="sex" required="required" value="0"> 男 </label>
                                    </div>
                                </li>
                                <li>
                                    <div class="radio">
                                        <label> <input type="radio" class="square" name="sex" required="required" value="1"> 女</label>
                                    </div>
                                </li>
                                <li>
                                    <div class="radio">
                                        <label> <input type="radio" class="square" name="sex" required="required" value="2"> 秘密</label>
                                    </div>
                                </li>
                                
                            </ul>
                        </div>
                    </div>
                    
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="birthday">出生日期 <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <div class='input-group date' id='myDatepicker'>
                                <input type='text' class="form-control" required="required" id="birthday" name="birthday" placeholder="请输入出生日期"/>
                                 <span class="input-group-addon">
                                   <span class="glyphicon glyphicon-remove"></span>
                                 </span>
                                <span class="input-group-addon">
                                   <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                                
                            </div>
                        </div>
                    </div>
                    
                    
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="mobile">手机: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="tel" class="form-control col-md-7 col-xs-12" name="mobile" id="mobile" required="required" data-validate-length-range="6,20" placeholder="请输入手机号"/>
                        </div>
                    </div>
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="phone">座机: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="tel" class="form-control col-md-7 col-xs-12" name="phone" id="phone" required="required" data-validate-length-range="6,20" placeholder="请输入座机号"/>
                        </div>
                    </div>
                    
                     <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="cardno">身份证号:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="cardNo" required="required" id="cardno" placeholder="请输入身份证号"/>
                        </div>
                    </div>
                    
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">邮箱:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="email" class="form-control col-md-7 col-xs-12" name="email" required="required" id="email" placeholder="请输入邮箱"/>
                        </div>
                    </div>
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="address">地址:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="address" id="address" required="required" placeholder="请输入地址"/>
                        </div>
                    </div>
                     <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="father">父亲:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="father" id="father" required="required" placeholder="请输入父亲姓名"/>
                        </div>
                    </div>
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="monther">母亲:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="monther" id="monther" required="required" placeholder="请输入母亲姓名"/>
                        </div>
                    </div>
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="extEvaluation">外部评估:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <textarea class="form-control col-md-7 col-xs-12" id="extEvaluation" name="extEvaluation"  required="required" placeholder="请输入外部评估类型"></textarea>
                        </div>
                    </div>
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="intEvaluation">内部评估:<span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <select name="intEvaluation" id="intEvaluation" class="form-control col-md-7 col-xs-12" required="required">
                            	<option value="">请选择</option>
                                		<@yyTag method="dicts" dictType="CHILDTYPE">
		                                    <#if dicts?? && dicts?size gt 0>
		                                        <#list dicts as dict>
		                                            <option value="${dict.dictTypeId}">${dict.dictTypeName}</option>
		                                        </#list>
		                                    <#else>
		                                        <option value="">无</option>
		                                    </#if>
		                                </@yyTag>
                            </select>
                            
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"> 关闭</i></button>
                <button type="button" class="btn btn-success addOrUpdateBtn"><i class="fa fa-save"> 保存</i></button>
            </div>
        </div>
    </div>
</div>
<!--/添加用户弹框-->
<@footer>
    <script>
        /**
         * 操作按钮
         * @param code
         * @param row
         * @param index
         * @returns {string}
         */
        function operateFormatter(code, row, index) {
            var currentUserId = '${user.id}';
            var trId = row.id;
            var operateBtn = [
                '<@shiro.hasPermission name="evaltemplate:edit"><a class="btn btn-xs btn-primary btn-update" data-id="' + trId + '"><i class="fa fa-edit"></i>编辑</a></@shiro.hasPermission>',
            ];
                operateBtn.push('<@shiro.hasPermission name="evaltemplate:delete"><a class="btn btn-xs btn-danger btn-remove" data-id="' + trId + '"><i class="fa fa-trash-o"></i>删除</a></@shiro.hasPermission>');
            return operateBtn.join('');
        }
        
         
        $(function () {
        	
        	var HtmlUtil = { 
        			/*1.用浏览器内部转换器实现html转码*/ 
        			htmlEncode:function (html){ 
	        			//1.首先动态创建一个容器标签元素，如DIV 
	        			var temp = document.createElement ("div"); 
	        			//2.然后将要转换的字符串设置为这个元素的innerText(ie支持)或者textContent(火狐，google支持) 
	        			(temp.textContent != undefined ) ? (temp.textContent = html) : (temp.innerText = html); 
	        			//3.最后返回这个元素的innerHTML，即得到经过HTML编码转换的字符串了 
	        			var output = temp.innerHTML; temp = null; return output; 
        			}, 
        			/*2.用浏览器内部转换器实现html解码*/ 
        			htmlDecode:function (text){ 
	        			//1.首先动态创建一个容器标签元素，如DIV 
	        			var temp = document.createElement("div"); 
	        			//2.然后将要转换的字符串设置为这个元素的innerHTML(ie，火狐，google都支持) 
	        			temp.innerHTML = text; 
	        			//3.最后返回这个元素的innerText(ie支持)或者textContent(火狐，google支持)，即得到经过HTML解码的字符串了。 
	        			var output = temp.innerText || temp.textContent; temp = null; return output; 
	        		}, 
	        		/*3.用正则表达式实现html转码*/ 
        			htmlEncodeByRegExp:function(str){ 
	        			var s = ""; 
	        			if(!str || str.length == 0) 
	        				return str; 
	        			s = str.replace(/&/g,"&amp;"); 
	        			s = s.replace(/</g,"&lt;"); 
	        			s = s.replace(/>/g,"&gt;"); 
	        			s = s.replace(/ /g,"&nbsp;"); 
	        			s = s.replace(/\'/g,"&#39;"); 
	        			s = s.replace(/\"/g,"&quot;"); 
	        			return s; 
	        		}, 
        			/*4.用正则表达式实现html解码*/ 
        			htmlDecodeByRegExp:function (str){ 
	        			var s = ""; 
	        			if(!str || str.length == 0) 
	        			return str; 
	        			s = str.replace(/&amp;/g,"&"); 
	        			s = s.replace(/&lt;/g,"<"); 
	        			s = s.replace(/&gt;/g,">"); 
	        			s = s.replace(/&nbsp;/g," "); 
	        			s = s.replace(/&#39;/g,"\'"); 
	        			s = s.replace(/&quot;/g,"\""); 
	        			return s; 
        			} 
        		};

            var options = {
                url: "/evaltemplate/list",
                getInfoUrl: "/evaltemplate/get/{id}",
                updateUrl: "/evaltemplate/edit",
                removeUrl: "/evaltemplate/remove",
                createUrl: "/evaltemplate/add",
                saveRolesUrl: "/evaltemplate/saveUserRoles",
                columns: [
                    {
                        checkbox: true
                    }, {
                        field: 'id',
                        title: '编号',
                        visible :false,
                        editable: false,
                    }, {
                        field: 'rowid',
                        title: 'rowid',
                        editable: false
                    }, {
                        field: 'intEvaluation',
                        title: '孩子类型',
                        visible :true,
                        editable: false,
                    }, {
                        field: 'typeId',
                        title: '类型大类',
                        visible :false,
                        editable: false,
                    }, {
                        field: 'trclasscss',
                        title: 'tr类样式',
                        editable: {
                            type: 'text',
                            title: 'tr类样式',
                            validate: function (v) {
                                if (!v) return 'tr类样式';

                            }
                        }
                        
                    }, {
                        field: 'trstylecss',
                        title: 'TRstyle样式',
                        editable: true
                    }, {
                        field: 'classcss',
                        title: '类样式',
                        visible :false,
                        editable: true
                    }, {
                        field: 'stylecss',
                        title: 'style样式',
                        visible :false,
                        editable: true
                    }, {
                        field: 'attroftr',
                        title: 'TR属性自定义',
                        visible :false,
                        editable: true
                    }, {
                        field: 'trtagb',
                        title: 'trtagb',
                        visible :false,
                        editable: true,
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'trtaga',
                        title: 'trtaga',
                        editable: true,
                        visible :false,
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'tdtagb',
                        title: 'tdtagb',
                        editable: true,
                        visible :false,
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'inputtype',
                        title: 'inputtype',
                        editable: {
                            type: 'select',
                            title: '输入框类型',
                            source:[{value:"",text:"无"},{value:"text",text:"文本框"},{value:"checkbox",text:"勾选框"},{value:"select",text:"下拉框"}]
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'inputclasscss',
                        title: 'inputclasscss',
                        editable: {
                            type: 'text',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'inputstylecss',
                        title: 'inputstylecss',
                        editable: {
                            type: 'text',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'inputbeforeval',
                        title: 'inputbeforeval',
                        editable: {
                            type: 'textarea',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'context',
                        title: 'context',
                        editable: {
                            type: 'textarea',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'remark',
                        title: 'remark',
                        editable: {
                            type: 'textarea',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'inputafterval',
                        title: 'inputafterval',
                        editable: {
                            type: 'textarea',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'roworder',
                        title: 'roworder',
                        editable: true,
                        formatter: function (code) {
                        	return code;
                        }
                    }, {
                        field: 'columnsort',
                        title: 'columnsort',
                        editable: true,
                        formatter: function (code) {
                        	return code;
                        }
                    }, {
                        field: 'labelclasscss',
                        title: 'labelclasscss',
                        editable: {
                            type: 'text',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'labelstylecss',
                        title: 'labelstylecss',
                        editable: {
                            type: 'text',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'attr',
                        title: 'attr',
                        editable: {
                            type: 'textarea',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'tag',
                        title: 'tag',
                        editable: {
                            type: 'text',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'std',
                        title: 'std',
                        editable: {
                            type: 'select',
                            title: '输入框类型',
                            source:[{value:"0",text:"0"},{value:"1",text:"1"}]
                        }
                    }, {
                        field: 'etd',
                        title: 'etd',
                        editable: {
                            type: 'select',
                            title: '输入框类型',
                            source:[{value:"0",text:"0"},{value:"1",text:"1"}]
                        }
                    }, {
                        field: 'tabb',
                        title: 'table标签前置',
                        editable: true,
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        },
                        editable: {
                            type: 'textarea',
                            title: 'table标签前置'
                        }
                    }, {
                        field: 'taba',
                        title: 'table标签后置',
                        editable: true,
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'tdtaga',
                        title: 'tdtaga',
                        visible :false,
                        editable: {
                            type: 'textarea',
                            title: '输入框类型'
                        },
                        formatter: function (code) {
                        	return HtmlUtil.htmlEncodeByRegExp(code);
                        }
                    }, {
                        field: 'operate',
                        title: '操作',
                        formatter: operateFormatter //自定义方法，添加操作按钮
                    }
                ],
                modalName: "评估模板"
            };
            //1.初始化Table
            $.tableUtil.init(options);
            //2.初始化Button的点击事件
            $.buttonUtil.init(options);
            
        });
        
        
    </script>
</@footer>